TLSv 1.3 対応の curl を Windows10 に Chocolatey でインストールしてみた

TLSv 1.3 対応の curl を Windows10 に Chocolatey でインストールしてみた

ちょこっとインストールしてみました。
Clock Icon2021.01.25

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

コンバンハ、千葉(幸)です。

先日、Mac に TLSv 1.3 に対応した curl をインストールしてみました。

せっかくなので、Windows 10 でも同様のことを試してみます。

インストール前の状態

Windows のバージョンはこちら。

Microsoft Windows [Version 10.0.19041.746]
(c) 2020 Microsoft Corporation. All rights reserved.

プリインストールされた curl のバージョンは以下です。

C:\Users\username>curl --version
curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Release-Date: 2017-11-14, security patched: 2019-11-05

--tlsv1.3オプションを使用すると以下のメッセージが。

C:\Users\username>curl https://google.com --tlsv1.3
curl: (35) Schannel: TLS 1.3 is not yet supported

curl: (35) Schannel: TLS 1.3 is not yet supported

Scnannel

Scannel とは、SSL/TLS を実装するセキュリティサービスプロバイダーのことです。

Scannel の TLS 1.3 の対応状況を確認すると、Windows 10, version 21H1からサポートされるようです。

将来的にはプリインストールの curl も TLS 1.3 に対応しそうですが、今回は別途インストールします。

curl のパッケージ

以下のページで、各種形式のパッケージがダウンロード可能となっています。

せっかくなので、今回はパッケージマネージャーの Chocolatey を使用してインストールを行ってみます。

Chocolatey のインストール

以下ページに記載のコマンドを実行するだけです。

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

実行ログは以下の通りです。

PS C:\WINDOWS\system32> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.15.
Extracting C:\Users\username\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\username\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when
  upgrading from a version of Chocolatey less than 0.9.9.
  'Batch file could not be found' is also safe to ignore.
  'The system cannot find the file specified' - also safe.
警告: Not setting tab completion: Profile file does not exist at
'C:\Users\username\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder

インストールされたバージョンは以下の通りです。

C:\Users\username>choco --version
0.10.15

Chocolatey による curl のインストール

コマンドプロンプトでchoco install curlを実行します。

C:\WINDOWS\system32>choco install curl -v
Chocolatey v0.10.15
Installing the following packages:
curl
By installing you accept licenses for the packages.
Progress: Downloading curl 7.73.0... 100%
[NuGet] Installing 'curl 7.73.0'.
[NuGet] Successfully installed 'curl 7.73.0'.

curl v7.73.0 [Approved]
curl package files install completed. Performing other installation steps.
The package curl wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint):Y

インストール時のログの詳細は割愛します。

折り畳み
VERBOSE: Exporting function 'Format-FileSize'.
VERBOSE: Exporting function 'Get-ChecksumValid'.
VERBOSE: Exporting function 'Get-ChocolateyUnzip'.
VERBOSE: Exporting function 'Get-ChocolateyWebFile'.
VERBOSE: Exporting function 'Get-EnvironmentVariable'.
VERBOSE: Exporting function 'Get-EnvironmentVariableNames'.
VERBOSE: Exporting function 'Get-FtpFile'.
VERBOSE: Exporting function 'Get-OSArchitectureWidth'.
VERBOSE: Exporting function 'Get-PackageParameters'.
VERBOSE: Exporting function 'Get-PackageParametersBuiltIn'.
VERBOSE: Exporting function 'Get-ToolsLocation'.
VERBOSE: Exporting function 'Get-UACEnabled'.
VERBOSE: Exporting function 'Get-UninstallRegistryKey'.
VERBOSE: Exporting function 'Get-VirusCheckValid'.
VERBOSE: Exporting function 'Get-WebFile'.
VERBOSE: Exporting function 'Get-WebFileName'.
VERBOSE: Exporting function 'Get-WebHeaders'.
VERBOSE: Exporting function 'Install-BinFile'.
VERBOSE: Exporting function 'Install-ChocolateyDesktopLink'.
VERBOSE: Exporting function 'Install-ChocolateyEnvironmentVariable'.
VERBOSE: Exporting function 'Install-ChocolateyExplorerMenuItem'.
VERBOSE: Exporting function 'Install-ChocolateyFileAssociation'.
VERBOSE: Exporting function 'Install-ChocolateyInstallPackage'.
VERBOSE: Exporting function 'Install-ChocolateyPackage'.
VERBOSE: Exporting function 'Install-ChocolateyPath'.
VERBOSE: Exporting function 'Install-ChocolateyPinnedTaskBarItem'.
VERBOSE: Exporting function 'Install-ChocolateyPowershellCommand'.
VERBOSE: Exporting function 'Install-ChocolateyShortcut'.
VERBOSE: Exporting function 'Install-ChocolateyVsixPackage'.
VERBOSE: Exporting function 'Install-ChocolateyZipPackage'.
VERBOSE: Exporting function 'Install-Vsix'.
VERBOSE: Exporting function 'Set-EnvironmentVariable'.
VERBOSE: Exporting function 'Set-PowerShellExitCode'.
VERBOSE: Exporting function 'Start-ChocolateyProcessAsAdmin'.
VERBOSE: Exporting function 'Test-ProcessAdminRights'.
VERBOSE: Exporting function 'Uninstall-BinFile'.
VERBOSE: Exporting function 'Uninstall-ChocolateyEnvironmentVariable'.
VERBOSE: Exporting function 'Uninstall-ChocolateyPackage'.
VERBOSE: Exporting function 'Uninstall-ChocolateyZipPackage'.
VERBOSE: Exporting function 'Update-SessionEnvironment'.
VERBOSE: Exporting function 'Write-ChocolateyFailure'.
VERBOSE: Exporting function 'Write-ChocolateySuccess'.
VERBOSE: Exporting function 'Write-FileUpdateLog'.
VERBOSE: Exporting function 'Write-FunctionCallLogMessage'.
VERBOSE: Exporting alias 'Get-ProcessorBits'.
VERBOSE: Exporting alias 'Get-OSBitness'.
VERBOSE: Exporting alias 'Get-InstallRegistryKey'.
VERBOSE: Exporting alias 'Generate-BinFile'.
VERBOSE: Exporting alias 'Add-BinFile'.
VERBOSE: Exporting alias 'Start-ChocolateyProcess'.
VERBOSE: Exporting alias 'Invoke-ChocolateyProcess'.
VERBOSE: Exporting alias 'Remove-BinFile'.
VERBOSE: Exporting alias 'refreshenv'.
VERBOSE: Exporting function 'Format-FileSize'.
VERBOSE: Exporting function 'Get-ChecksumValid'.
VERBOSE: Exporting function 'Get-ChocolateyUnzip'.
VERBOSE: Exporting function 'Get-ChocolateyWebFile'.
VERBOSE: Exporting function 'Get-EnvironmentVariable'.
VERBOSE: Exporting function 'Get-EnvironmentVariableNames'.
VERBOSE: Exporting function 'Get-FtpFile'.
VERBOSE: Exporting function 'Get-OSArchitectureWidth'.
VERBOSE: Exporting function 'Get-PackageParameters'.
VERBOSE: Exporting function 'Get-PackageParametersBuiltIn'.
VERBOSE: Exporting function 'Get-ToolsLocation'.
VERBOSE: Exporting function 'Get-UACEnabled'.
VERBOSE: Exporting function 'Get-UninstallRegistryKey'.
VERBOSE: Exporting function 'Get-VirusCheckValid'.
VERBOSE: Exporting function 'Get-WebFile'.
VERBOSE: Exporting function 'Get-WebFileName'.
VERBOSE: Exporting function 'Get-WebHeaders'.
VERBOSE: Exporting function 'Install-BinFile'.
VERBOSE: Exporting function 'Install-ChocolateyDesktopLink'.
VERBOSE: Exporting function 'Install-ChocolateyEnvironmentVariable'.
VERBOSE: Exporting function 'Install-ChocolateyExplorerMenuItem'.
VERBOSE: Exporting function 'Install-ChocolateyFileAssociation'.
VERBOSE: Exporting function 'Install-ChocolateyInstallPackage'.
VERBOSE: Exporting function 'Install-ChocolateyPackage'.
VERBOSE: Exporting function 'Install-ChocolateyPath'.
VERBOSE: Exporting function 'Install-ChocolateyPinnedTaskBarItem'.
VERBOSE: Exporting function 'Install-ChocolateyPowershellCommand'.
VERBOSE: Exporting function 'Install-ChocolateyShortcut'.
VERBOSE: Exporting function 'Install-ChocolateyVsixPackage'.
VERBOSE: Exporting function 'Install-ChocolateyZipPackage'.
VERBOSE: Exporting function 'Install-Vsix'.
VERBOSE: Exporting function 'Set-EnvironmentVariable'.
VERBOSE: Exporting function 'Set-PowerShellExitCode'.
VERBOSE: Exporting function 'Start-ChocolateyProcessAsAdmin'.
VERBOSE: Exporting function 'Test-ProcessAdminRights'.
VERBOSE: Exporting function 'Uninstall-BinFile'.
VERBOSE: Exporting function 'Uninstall-ChocolateyEnvironmentVariable'.
VERBOSE: Exporting function 'Uninstall-ChocolateyPackage'.
VERBOSE: Exporting function 'Uninstall-ChocolateyZipPackage'.
VERBOSE: Exporting function 'Update-SessionEnvironment'.
VERBOSE: Exporting function 'Write-ChocolateyFailure'.
VERBOSE: Exporting function 'Write-ChocolateySuccess'.
VERBOSE: Exporting function 'Write-FileUpdateLog'.
VERBOSE: Exporting function 'Write-FunctionCallLogMessage'.
VERBOSE: Exporting alias 'Get-ProcessorBits'.
VERBOSE: Exporting alias 'Get-OSBitness'.
VERBOSE: Exporting alias 'Get-InstallRegistryKey'.
VERBOSE: Exporting alias 'Generate-BinFile'.
VERBOSE: Exporting alias 'Add-BinFile'.
VERBOSE: Exporting alias 'Start-ChocolateyProcess'.
VERBOSE: Exporting alias 'Invoke-ChocolateyProcess'.
VERBOSE: Exporting alias 'Remove-BinFile'.
VERBOSE: Exporting alias 'refreshenv'.
VERBOSE: Importing function 'Format-FileSize'.
VERBOSE: Importing function 'Get-ChecksumValid'.
VERBOSE: Importing function 'Get-ChocolateyUnzip'.
VERBOSE: Importing function 'Get-ChocolateyWebFile'.
VERBOSE: Importing function 'Get-EnvironmentVariable'.
VERBOSE: Importing function 'Get-EnvironmentVariableNames'.
VERBOSE: Importing function 'Get-FtpFile'.
VERBOSE: Importing function 'Get-OSArchitectureWidth'.
VERBOSE: Importing function 'Get-PackageParameters'.
VERBOSE: Importing function 'Get-PackageParametersBuiltIn'.
VERBOSE: Importing function 'Get-ToolsLocation'.
VERBOSE: Importing function 'Get-UACEnabled'.
VERBOSE: Importing function 'Get-UninstallRegistryKey'.
VERBOSE: Importing function 'Get-VirusCheckValid'.
VERBOSE: Importing function 'Get-WebFile'.
VERBOSE: Importing function 'Get-WebFileName'.
VERBOSE: Importing function 'Get-WebHeaders'.
VERBOSE: Importing function 'Install-BinFile'.
VERBOSE: Importing function 'Install-ChocolateyDesktopLink'.
VERBOSE: Importing function 'Install-ChocolateyEnvironmentVariable'.
VERBOSE: Importing function 'Install-ChocolateyExplorerMenuItem'.
VERBOSE: Importing function 'Install-ChocolateyFileAssociation'.
VERBOSE: Importing function 'Install-ChocolateyInstallPackage'.
VERBOSE: Importing function 'Install-ChocolateyPackage'.
VERBOSE: Importing function 'Install-ChocolateyPath'.
VERBOSE: Importing function 'Install-ChocolateyPinnedTaskBarItem'.
VERBOSE: Importing function 'Install-ChocolateyPowershellCommand'.
VERBOSE: Importing function 'Install-ChocolateyShortcut'.
VERBOSE: Importing function 'Install-ChocolateyVsixPackage'.
VERBOSE: Importing function 'Install-ChocolateyZipPackage'.
VERBOSE: Importing function 'Install-Vsix'.
VERBOSE: Importing function 'Set-EnvironmentVariable'.
VERBOSE: Importing function 'Set-PowerShellExitCode'.
VERBOSE: Importing function 'Start-ChocolateyProcessAsAdmin'.
VERBOSE: Importing function 'Test-ProcessAdminRights'.
VERBOSE: Importing function 'Uninstall-BinFile'.
VERBOSE: Importing function 'Uninstall-ChocolateyEnvironmentVariable'.
VERBOSE: Importing function 'Uninstall-ChocolateyPackage'.
VERBOSE: Importing function 'Uninstall-ChocolateyZipPackage'.
VERBOSE: Importing function 'Update-SessionEnvironment'.
VERBOSE: Importing function 'Write-ChocolateyFailure'.
VERBOSE: Importing function 'Write-ChocolateySuccess'.
VERBOSE: Importing function 'Write-FileUpdateLog'.
VERBOSE: Importing function 'Write-FunctionCallLogMessage'.
VERBOSE: Importing alias 'Add-BinFile'.
VERBOSE: Importing alias 'Generate-BinFile'.
VERBOSE: Importing alias 'Get-InstallRegistryKey'.
VERBOSE: Importing alias 'Get-OSBitness'.
VERBOSE: Importing alias 'Get-ProcessorBits'.
VERBOSE: Importing alias 'Invoke-ChocolateyProcess'.
VERBOSE: Importing alias 'refreshenv'.
VERBOSE: Importing alias 'Remove-BinFile'.
VERBOSE: Importing alias 'Start-ChocolateyProcess'.
Extracting 64-bit C:\ProgramData\chocolatey\lib\curl\tools\curl-7.73.0-win64-mingw.zip to C:\ProgramData\chocolatey\lib\curl\tools...
VERBOSE:
VERBOSE: 7-Zip 18.06 (x86) : Copyright (c) 1999-2018 Igor Pavlov : 2018-12-30
VERBOSE: Extracting archive: C:\ProgramData\chocolatey\lib\curl\tools\curl-7.73.0-win64-mingw.zip
VERBOSE:
VERBOSE: 1 file, 3529249 bytes (3447 KiB)
VERBOSE: Scanning the drive for archives:
VERBOSE:
VERBOSE: Path = C:\ProgramData\chocolatey\lib\curl\tools\curl-7.73.0-win64-mingw.zip
VERBOSE: - curl-7.73.0-win64-mingw\BUILD-HOMEPAGE.url
VERBOSE:
VERBOSE: Physical Size = 3529249
VERBOSE: - curl-7.73.0-win64-mingw\BUILD-README.txt
VERBOSE: Type = zip
VERBOSE: - curl-7.73.0-win64-mingw\CHANGES.txt
VERBOSE: - curl-7.73.0-win64-mingw\COPYING-libssh2.txt
VERBOSE: - curl-7.73.0-win64-mingw\COPYING-brotli.txt
VERBOSE: - curl-7.73.0-win64-mingw\COPYING-zlib.txt
VERBOSE: - curl-7.73.0-win64-mingw\COPYING-nghttp2.txt
VERBOSE: - curl-7.73.0-win64-mingw\LICENSE-openssl.txt
VERBOSE: - curl-7.73.0-win64-mingw\README.txt
VERBOSE: - curl-7.73.0-win64-mingw\RELEASE-NOTES.txt
VERBOSE: - curl-7.73.0-win64-mingw\bin\curl-ca-bundle.crt
VERBOSE: - curl-7.73.0-win64-mingw\bin\curl.exe
VERBOSE: - curl-7.73.0-win64-mingw\bin\libcurl-x64.def
VERBOSE: - curl-7.73.0-win64-mingw\bin\libcurl-x64.dll
VERBOSE: - curl-7.73.0-win64-mingw\docs\ALTSVC.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\BUG-BOUNTY.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\BINDINGS.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\BUGS.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\CHECKSRC.md
VERBOSE: - curl-7.73.0-win64-mingw\COPYING.txt
VERBOSE: --
VERBOSE: - curl-7.73.0-win64-mingw\docs\CIPHERS.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\CODE_OF_CONDUCT.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\CODE_REVIEW.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\CODE_STYLE.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\CONTRIBUTE.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\CURL-DISABLE.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\DEPRECATE.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\DYNBUF.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\EXPERIMENTAL.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\ECH.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\FAQ.txt
VERBOSE: - curl-7.73.0-win64-mingw\docs\FEATURES.txt
VERBOSE: - curl-7.73.0-win64-mingw\docs\GOVERNANCE.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\HELP-US.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\HISTORY.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\HTTP-COOKIES.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\HTTP2.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\HTTP3.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\INSTALL.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\INSTALL.txt
VERBOSE: - curl-7.73.0-win64-mingw\docs\INTERNALS.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\KNOWN_BUGS.txt
VERBOSE: - curl-7.73.0-win64-mingw\docs\MAIL-ETIQUETTE.txt
VERBOSE: - curl-7.73.0-win64-mingw\docs\MQTT.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\PARALLEL-TRANSFERS.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\RELEASE-PROCEDURE.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\README.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\ROADMAP.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\SECURITY-PROCESS.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\SSL-PROBLEMS.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\SSLCERTS.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\THANKS.txt
VERBOSE: - curl-7.73.0-win64-mingw\docs\TODO.txt
VERBOSE: - curl-7.73.0-win64-mingw\docs\TheArtOfHttpScripting.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\VERSIONS.md
VERBOSE: - curl-7.73.0-win64-mingw\docs\libcurl\symbols-in-versions.txt
VERBOSE: - curl-7.73.0-win64-mingw\docs\options-in-versions.txt
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\curl.h
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\curlver.h
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\easy.h
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\mprintf.h
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\multi.h
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\options.h
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\stdcheaders.h
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\system.h
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\typecheck-gcc.h
VERBOSE: - curl-7.73.0-win64-mingw\include\curl\urlapi.h
VERBOSE: - curl-7.73.0-win64-mingw\lib\libcurl.a
VERBOSE: - curl-7.73.0-win64-mingw\lib\libcurl.dll.a
VERBOSE: - curl-7.73.0-win64-mingw\mk-ca-bundle.pl
VERBOSE:
VERBOSE: Everything is Ok
VERBOSE: Files: 70
VERBOSE: Compressed: 3529249
VERBOSE: Size:       7821262

最後に以下のログが出力され、インストールが完了です。

C:\ProgramData\chocolatey\lib\curl\tools
 ShimGen has successfully created a shim for curl.exe
 The install of curl was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\curl\tools'

Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

フルパスで指定してバージョンを確認すると以下の通りです。

C:\WINDOWS\system32>"C:\ProgramData\chocolatey\lib\curl\tools\curl-7.73.0-win64-mingw\bin\curl.exe" --version
curl 7.73.0 (x86_64-pc-win32) libcurl/7.73.0 OpenSSL/1.1.1h (Schannel) zlib/1.2.11 brotli/1.0.9 zstd/1.4.5 WinIDN libssh2/1.9.0 nghttp2/1.41.0
Release-Date: 2020-10-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP Unicode UnixSockets brotli libz zstd

パスを通す

上記の操作が完了した時点では、プリインストールされた curl の方が優先度が高くなっています。

C:\Users\username>where curl

C:\Windows\System32\curl.exe
C:\ProgramData\chocolatey\bin\curl.exe

今回インストールした curl が存在するC:\ProgramData\chocolatey\bin\の優先度を上げることで対応します。

[ システムのプロパティ ] - [ 詳細設定 ] より、環境変数の詳細画面に遷移します。

curl1

システム環境変数のPathを選択し、編集画面に遷移します。

curl2

curl3

C:\ProgramData\chocolatey\bin\の位置を上に移動し、設定を保存します。

ふたたび curl の優先順位を確認すると、新規にインストールしたものの方が高くなっていることがわかります。

C:\Users\username>where curl

C:\ProgramData\chocolatey\bin\curl.exe
C:\Windows\System32\curl.exe

インストール後の curl の実行

弊社カフェサイト--tlsv1.3オプションを指定し curl を実行します。

C:\Users\username>curl -s -v --tlsv1.3 https://cafe.classmethod.jp > null
*   Trying 99.84.55.20:443...
* Connected to http://cafe.classmethod.jp (99.84.55.20) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: C:\ProgramData\chocolatey\lib\curl\tools\curl-7.73.0-win64-mingw\bin\curl-ca-bundle.crt
*  CApath: none
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [10 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [4853 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [264 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [36 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [36 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=*.classmethod.jp
*  start date: Jun  7 00:00:00 2020 GMT
*  expire date: Jul  7 12:00:00 2021 GMT
*  subjectAltName: host "http://cafe.classmethod.jp" matched cert's "*.classmethod.jp"
*  issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
*  SSL certificate verify ok.
} [5 bytes data]
> GET / HTTP/1.1
> Host: http://cafe.classmethod.jp
> User-Agent: curl/7.73.0
> Accept: */*
>
{ [5 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/html
< Content-Length: 11555
< Connection: keep-alive
< Date: Sun, 24 Jan 2021 14:50:47 GMT
< Last-Modified: Mon, 19 Oct 2020 05:29:04 GMT
< x-amz-version-id: qKNuzgURcH8RPmhE25b51HNV8E13kvo2
< ETag: "b44c8f658d8ab92e369de3722b953df1"
< Server: AmazonS3
< X-Cache: Hit from cloudfront
< Via: 1.1 http://50822c8cf2064dde0abeff809b1b0606.cloudfront.net (CloudFront)
< X-Amz-Cf-Pop: NRT20-C3
< X-Amz-Cf-Id: YiPpuIIME4meGV3V45gVsmv-JvrOE7i-H7k_r1VYOixqmvh133xpiw==
< Age: 48
<
{ [5 bytes data]
* Connection #0 to host http://cafe.classmethod.jp left intact

TLSv 1.3 を使用してコネクションできることを確認できました。

終わりに

Chocolatey を利用した curl のインストールを試してみました。

Windows ではパッケージ管理ツールを使ってこなかったのですが、便利そうですね。

どなたかの参考になれば幸いです。

以上、千葉(幸)が送りしました。

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.